package com.albon.soccer;

import com.albon.sportsalarm.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class SoccerMain extends Activity implements OnClickListener{

	private LinearLayout epl_group; //EPL
	private LinearLayout lfp_group; //프리메가리가
	private LinearLayout lnp_group; //세리에A
	private LinearLayout dfl_group; //분데스리가
	private LinearLayout ligue1_group; //리그1
	private LinearLayout spl_group;  //SPL
	private LinearLayout uefacl_group; //챔피언스리그
	private LinearLayout uefacup_group; //유로파
	private LinearLayout k_league_group; //k리그
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sports_main);
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		init();
	}
	
	
	private void init(){
		epl_group = (LinearLayout)findViewById(R.id.epl_group);
		lfp_group = (LinearLayout)findViewById(R.id.lfp_group);
		lnp_group = (LinearLayout)findViewById(R.id.lnp_group);
		dfl_group = (LinearLayout)findViewById(R.id.dfl_group);
		ligue1_group = (LinearLayout)findViewById(R.id.ligue1_group);
		spl_group = (LinearLayout)findViewById(R.id.spl_group);
		uefacl_group = (LinearLayout)findViewById(R.id.uefacl_group);
		uefacup_group = (LinearLayout)findViewById(R.id.uefacup_group);
		k_league_group = (LinearLayout)findViewById(R.id.k_league_group);
		epl_group.setOnClickListener(this);
		lfp_group.setOnClickListener(this);
		lnp_group.setOnClickListener(this);
		dfl_group.setOnClickListener(this);
		ligue1_group.setOnClickListener(this);
		spl_group.setOnClickListener(this);
		uefacl_group.setOnClickListener(this);
		uefacup_group.setOnClickListener(this);
		k_league_group.setOnClickListener(this);
	}

	
	/*OnClickListener*/
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.epl_group:
			  Intent epl_group_intent = new Intent(this, SoccerLeague.class);
			  epl_group_intent.putExtra("league_name", "epl");
			  epl_group_intent.putExtra("league_title",  getText(R.string.epl).toString());
			  epl_group_intent.putExtra("world",  0);
			  startActivity(epl_group_intent);
			break;
	
		case R.id.lfp_group:
			Intent lfp_group_intent = new Intent(this, SoccerLeague.class);
			lfp_group_intent.putExtra("league_name", "lfp");
			lfp_group_intent.putExtra("league_title", getText(R.string.lfp).toString());
			lfp_group_intent.putExtra("world",  0);
			startActivity(lfp_group_intent);
			break;
			
		case R.id.lnp_group:
			Intent lnp_group_intent = new Intent(this, SoccerLeague.class);
			lnp_group_intent.putExtra("league_name", "lnp");
			lnp_group_intent.putExtra("league_title", getText(R.string.lnp).toString());
			lnp_group_intent.putExtra("world",  0);
			startActivity(lnp_group_intent);
			break;
		case R.id.dfl_group:
			Intent dfl_group_intent = new Intent(this, SoccerLeague.class);
			dfl_group_intent.putExtra("league_name", "dfl");
			dfl_group_intent.putExtra("league_title", getText(R.string.dfl).toString());
			dfl_group_intent.putExtra("world",  0);
			startActivity(dfl_group_intent);
			break;
			
		case R.id.ligue1_group:
			Intent ligue1_group_intent = new Intent(this, SoccerLeague.class);
			ligue1_group_intent.putExtra("league_name", "ligue1");
			ligue1_group_intent.putExtra("league_title", getText(R.string.ligue1).toString());
			ligue1_group_intent.putExtra("world",  0);
			startActivity(ligue1_group_intent);
			break;
			
		case R.id.spl_group:
			Intent spl_group_intent = new Intent(this, SoccerLeague.class);
			spl_group_intent.putExtra("league_name", "spl");
			spl_group_intent.putExtra("league_title", getText(R.string.spl).toString());
			spl_group_intent.putExtra("world",  0);
			startActivity(spl_group_intent);
			break;
			
		case R.id.uefacl_group:
			Intent uefacl_group_intent = new Intent(this, SoccerLeague.class);
			uefacl_group_intent.putExtra("league_name", "uefacl");
			uefacl_group_intent.putExtra("league_title", getText(R.string.uefacl).toString());
			uefacl_group_intent.putExtra("world",  0);
			startActivity(uefacl_group_intent);
			break;
			
		case R.id.uefacup_group:
			Intent uefacup_group_intent = new Intent(this, SoccerLeague.class);
			uefacup_group_intent.putExtra("league_name", "uefacup");
			uefacup_group_intent.putExtra("league_title", getText(R.string.uefacup).toString());
			uefacup_group_intent.putExtra("world",  0);
			startActivity(uefacup_group_intent);
			break;
			
		case R.id.k_league_group:
			Intent k_league_group_intent = new Intent(this, SoccerLeague.class);
			k_league_group_intent.putExtra("league_name", "k_league");
			k_league_group_intent.putExtra("league_title", getText(R.string.k_league).toString());
			k_league_group_intent.putExtra("world",  1);
			startActivity(k_league_group_intent);
			break;
			
		}
	}
}
